﻿using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Windows.Forms;
using TransferPost.checkpoints;

namespace TransferPost.util
{
    public class Tools
    {
        
        /// <summary>
        /// add by zhzhh at 2020年1月9日 16点32分
        /// 简单处理
        /// 
        /// </summary>
        /// <returns></returns>
        public static Version GetVersionInfo()
        {
            string result = "1.0.0.1";

            try
            {
                WebRequest req = HttpWebRequest.Create(PostContext.URL_SVNIGNORECFG + "ver.html");
                req.Timeout = 5000;

                using (WebResponse wr = req.GetResponse())
                {
                    StreamReader sr = new StreamReader(wr.GetResponseStream(), Encoding.UTF8);
                    result = sr.ReadToEnd().Trim();
                }
            }
            catch (Exception e)
            {
                //MessageBox.Show("网络连接异常，无法访问" + URL_SVNIGNORECFG);
            }

            return new Version(result);
        }

    }
}
